from pickle import load, dump
from tkinter import Tk, Label, simpledialog, Button
try:
    with open('data1.pkl', 'rb') as f:
        data = load(f)
except FileNotFoundError:
    data = []
def out():
    with open('data.pkl', 'wb') as f:
        dump(data, f)
    quit()
def add():
    global button1, button2
    da1 = simpledialog.askstring('Add', 'Add')
    if da1 == "" or da1 is None:
        return
    data.append(da1)
    button2.destroy()
    button1.destroy()
    Label(tk, text=da1).pack()
    button1 = Button(tk, text='Save', command=out)
    button2 = Button(tk, text='Add', command=add)
    button2.pack()
    button1.pack()
tk = Tk()
tk.title('Auto In')
tk.geometry('800x800')
for i in data:
    Label(tk, text=i).pack()
button2 = Button(tk, text='Add', command=add)
button1=Button(tk, text='Save', command=out)
button2.pack()
button1.pack()
tk.mainloop()